using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;

namespace BUS
{
    public class PhieuThuePhongBUS
    {
        public PhieuThuePhongDTO[] LayPhieuThuePhongTheoMaKhachHang(int MaKH)
        {
            PhieuThuePhongDTO[] Arr = new PhieuThuePhongDTO[100];
            try
            {
                PhieuThuePhongDAO ptpDAO = new PhieuThuePhongDAO();
                Arr = ptpDAO.LayPhieuThuePhongTheoMaKhachHang(MaKH);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Arr;
        }

        public int ThemPhieuThuePhong(int MaPTP, int MaKH, int MaP, Double DonGia, DateTime NgayLap, DateTime NgayThue, Double TienCoc)
        {
            MaPTP = 0;
            try
            {
                PhieuThuePhongDAO ptpDAO = new PhieuThuePhongDAO();
                MaPTP = ptpDAO.ThemPhieuThuePhong(MaPTP, MaKH, MaP, DonGia, NgayLap, NgayThue, TienCoc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return MaPTP;
        }

        public void CapNhatPhieuThuePhong(int MaPTP, int MaKH, int MaP, Double DonGia, DateTime NgayLap, DateTime NgayThue, Double TienCoc, int TinhTrang)
        {
            try
            {
                PhieuThuePhongDAO ptpDAO = new PhieuThuePhongDAO();
                ptpDAO.CapNhatPhieuThuePhong(MaPTP, MaKH, MaP, DonGia, NgayLap, NgayThue, TienCoc, TinhTrang);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public PhieuThuePhongDTO[] TimKiemPhieuThuePhong(int MaKH, int MaPhong, int MaTT, Double DonGia, Double TienCoc, DateTime NgayLapTu, DateTime NgayLapDen, DateTime NgayBatDauTu, DateTime NgayBatDauDen)
        {
            PhieuThuePhongDTO[] Arr = new PhieuThuePhongDTO[100];
            try
            {
                PhieuThuePhongDAO ptpDAO = new PhieuThuePhongDAO();
                Arr = ptpDAO.TimKiemPhieuThuePhong(MaKH, MaPhong, MaTT, DonGia, TienCoc, NgayLapTu, NgayLapDen, NgayBatDauTu, NgayBatDauDen);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Arr;
        }

        public PhieuThuePhongDTO[] LayDanhSachPhieuThue()
        {
            PhieuThuePhongDTO[] Arr = new PhieuThuePhongDTO[100];
            try
            {
                PhieuThuePhongDAO ptpDAO = new PhieuThuePhongDAO();
                Arr = ptpDAO.LayDanhSachPhieuThue();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Arr;
        }
    }
}
